#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ 
install:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	# Create a dir called geonode and unzip the tarball there
	mkdir -p $(CURDIR)/geonode
	tar zxvf $(CURDIR)/GeoNode*.tar.gz -C $(CURDIR)/geonode --strip 1
	# Call geonode's install.sh with the pre flag.
	$(CURDIR)/geonode/install.sh -s pre $(CURDIR)/debian/support/config-pre.sh
	# Copying installer and configuration to be used by post installer
	cp $(CURDIR)/geonode/install.sh $(CURDIR)/debian/geonode/usr/share/geonode
	cp $(CURDIR)/debian/support/config-post.sh $(CURDIR)/debian/geonode/usr/share/geonode
	rm -rf $(CURDIR)/geonode
binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf
	dh_installdocs
#       dh_installmenu
#       dh_link
#       dh_strip
#       dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
#       .PHONY: build clean binary-indep binary-arch binary install

